import dbConfApi from '@/api/declaration/dbConfApi'
import httpRequest from '@/config/axios/httpRequest'
import { DbConfigModel } from '@/models/confs/DbConfigModel'

// 新增数据源配置
export const createDataSourceConfig = (data: DbConfigModel) => {
  return httpRequest.post(dbConfApi.CreateDataSourceConfig, data)
}

// 修改数据源配置
export const updateDataSourceConfig = (data: DbConfigModel) => {
  return httpRequest.put(dbConfApi.UpdateDataSourceConfig, data)
}

// 删除数据源配置
export const deleteDataSourceConfig = (id: number) => {
  return httpRequest.delete(dbConfApi.DeleteDataSourceConfig, {
    params: {
      id
    }
  })
}

// 查询数据源配置详情
export const getDataSourceConfig = (id: number) => {
  return httpRequest.get(dbConfApi.GetDataSourceConfig, {
    params: {
      id
    }
  })
}

// 查询数据源配置列表
export const getDataSourceConfigList = () => {
  return httpRequest.get(dbConfApi.GetDataSourceConfigList)
}
